package com.hq.mapper;

import com.hq.pojo.WebUser;
import org.junit.jupiter.api.Test;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@MapperScan("com.hq.mapper")
@SpringBootTest
class UserDaoTest {
    @Autowired
    public UserDao userDao;



    @Test
    void insert() {
        //用户添加
        WebUser useri=new WebUser("sdftiujh","晚上","123456","USER");
        useri.setToken("电饭锅版本");
     int id=userDao.insert(useri);
       System.out.println(id);
    }

    @Test
    void selectById() {

        WebUser id = userDao.selectById(2);
        System.out.println(id);


    }
    @Test
    void selectByUserId() {
        //通过 用户id 查询一条用户信息
        WebUser user = userDao.selectByUserId(new WebUser("root"));
        System.out.println(user);


    }
    @Test
    void selectObj() {
        //用户添加
        WebUser useri=new WebUser("sdf","更新","123456","USER");
        useri.setId(5);
        int id = userDao.updateById(useri);
        System.out.println(id);


    }

}